import { createVNode } from "vue";
// import { ExclamationCircleOutlined } from '@ant-design/icons-vue';'
// import { useRouter } from "vue-router";
import { postAction } from "@/api/manage";
import {localCache} from '@/utils/storage'
import { ElMessage, ElMessageBox } from 'element-plus'
/* 
退出
*/
export function logout() {
  ElMessageBox.confirm(
    '退出登录?',
    '提示',
    {
      confirmButtonText: '确认',
      cancelButtonText: '取消',
      type: 'warning',
    }
  )
    .then(() => {
        // postAction("/logout/", {}).then((res: any) => {
        //     if (res.status) {
              localCache.clearCache()
              // 提示退出成功
              ElMessage({
                type: 'success',
                message: '退出登录',
              })
              // 跳转到登录页
              //  router.push({ name: "Login" });
              // 刷新整个浏览器
              setTimeout(() => {
                window.location.reload();
              }, 100)
          //   }
          // });
          //
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: '取消退出登录',
      })
    })
}
